<%--
  Created by IntelliJ IDEA.
  User: 86166
  Date: 2024/08/17
  Time: 20:41
  To change this template use File | Settings | File Templates.
  我的凭证列表
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>融资管理系统</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
</head>
<body data-type="generalComponents">
<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="tpl-header-list-user-nick" id="name">   </span><span class="tpl-header-list-user-ico"> <img
                        src="assets/img/user01.png"></span>
                </a>
                <ul class="am-dropdown-content">
                    <li><a href="login.jsp"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
</header>
<div class="tpl-page-container tpl-page-header-fixed">
    <div class="tpl-left-nav tpl-left-nav-hover">
        <div class="tpl-left-nav-list">
            <ul class="tpl-left-nav-menu">
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list ">
                        <i class="am-icon-table"></i>
                        <span>凭证管理</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu">
                        <li>
                            <a id="rongzi">
                                <i class="am-icon-angle-right"></i>
                                <span>融资列表</span>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list active">
                        <i class="am-icon-wpforms"></i>
                        <span>我的凭证</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu" style="display:block">
                        <li>
                            <a id="myself" class="active" >
                                <i class="am-icon-angle-right"></i>
                                <span>我的凭证列表</span>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="tpl-content-wrapper">
        <div class="tpl-content-page-title">
            我的凭证列表
        </div>
        <ol class="am-breadcrumb">
            <li class="am-active"><a style="color: #999999;">我的凭证</a></li>
            <li class="am-active">我的凭证列表</li>
        </ol>
        <div class="tpl-portlet-components">
            <div class="tpl-block">
                <div class="am-g">
                    <div class="am-u-sm-6 am-u-md-3">
                        <div class="am-input-group am-input-group-sm">
                                <span class="am-input-group-btn">
                                    <span style="font-size: 14px;margin-right: 8px;margin-left: 8px">凭证编号</span>
                                </span>
                            <input id="No" type="text" class="am-form-field" placeholder="&nbsp;&nbsp;请输入凭证编号"
                                   style="border: 1px solid #c2cad8;width: 68%;border-radius: 3px;">
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-3">
                        <div class="am-form-group">
                            <span style="font-size: 14px;">收单企业</span>
                            <select id="enterprise" data-am-selected="{btnSize: 'sm'}">
                                <option value="-1" id="ent0">请选择收单企业</option>
                                <option value="a"  id="ent1">阿里科技有限公司</option>
                                <option value="b"  id="ent2">腾讯科技有限公司</option>
                                <option value="c"  id="ent3">百度科技有限公司</option>
                                <option value="d"  id="ent4">隆基股份有限公司</option>
                                <option value="e"  id="ent5">京东集团</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-3">
                        <div class="am-form-group">
                            <span style="font-size: 14px;">开单企业</span>
                            <select id="open_enterprise" class="am-form-field" data-am-selected="{btnSize: 'sm'}">
                                <option value="-1" id="Oent0">请选择收单企业</option>
                                <option value="a"  id="Oent1">阿里科技有限公司</option>
                                <option value="b"  id="Oent2">腾讯科技有限公司</option>
                                <option value="c"  id="Oent3">百度科技有限公司</option>
                                <option value="d"  id="Oent4">隆基股份有限公司</option>
                                <option value="e"  id="Oent5">京东集团</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-3">
                        <div class="am-input-group am-input-group-sm">
                                <span class="am-input-group-btn">
                                    <span style="font-size: 14px;margin-right: 8px;margin-left: 8px;">开单日期</span>
                                </span>
                            <input type="text" name="time" class="am-form-field" data-am-datepicker
                                   placeholder="&nbsp;&nbsp;请选择日期"
                                   style="border: 1px solid #c2cad8;width: 68%;border-radius: 3px;">
                        </div>
                    </div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-6 am-u-md-3">
                        <div class="am-input-group am-input-group-sm">
                                <span class="am-input-group-btn">
                                    <span style="font-size: 14px;margin-right: 8px;margin-left: 8px">凭证金额</span>
                                </span>
                            <input id="Min" type="text" class="am-form-field" placeholder="&nbsp;&nbsp;最低金额(万)"
                                   style="border: 1px solid #c2cad8;width: 32%;border-radius: 3px;">
                            <div class="am-form-field"
                                 style="width: 0%; border-radius: 3px;border: none;margin-left: 10px;">~
                            </div>
                            <input id="Max" type="text" class="am-form-field" placeholder="&nbsp;&nbsp;最高金额(万)"
                                   style="border: 1px solid #c2cad8;width: 32%;border-radius: 3px;margin-left: 20px;">
                        </div>
                    </div>
                    <div class="am-u-sm-6 am-u-md-3">
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr>
                                <th class="table-title">凭证编号</th>
                                <th class="table-author am-hide-sm-only">凭证金额（元）</th>
                                <th class="table-date am-hide-sm-only">开单企业</th>
                                <th class="table-date am-hide-sm-only">金融机构</th>
                                <th class="table-date am-hide-sm-only">开单日期</th>
                                <th class="table-date am-hide-sm-only">到期日期</th>
                                <th class="table-date am-hide-sm-only">上链地址</th>
                                <th class="table-date am-hide-sm-only">凭证来源</th>
                                <th class="table-date am-hide-sm-only">凭证状态</th>
                                <th class="table-set">操作</th>
                            </tr>
                            </thead>
                            <tbody id="doc-modal-list">
                            <tr data-id="2">
                                <td class="am-hide-sm-only" name='pingzhengbianhao'></td>
                                <td class="am-hide-sm-only" name="pingzhengjine"></td>
                                <td class="am-hide-sm-only" name="kaidanqiye"></td>
                                <td class="am-hide-sm-only" name="jingrongjigou"></td>
                                <td class="am-hide-sm-only" name="kaidanriqi"></td>
                                <td class="am-hide-sm-only" name="daoqiriqi">
                                    <span style="color: #ccc;font-size:12px">  </span></td>
                                <td class="am-hide-sm-only" name="shangliandizhi"></td>
                                <td class="am-hide-sm-only" name="pingzhenglaiyuan"></td>
                                <td class="am-hide-sm-only" name="pingzhengzhuangtai"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a><span class="am-text-secondary"
                                                     style="cursor:pointer"><span></span>
                                                        详情</span></a>
                                            <a><span class="am-text-secondary"
                                                     style="cursor:pointer"><span></span>
                                                            融资</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr data-id="2">
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only">
                                    <span style="color: #ccc;font-size:12px"> </span></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a><span class="am-text-secondary"
                                                     style="cursor:pointer"><span></span>
                                                        详情</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr data-id="2">
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only">
                                    <span style="color: #ccc;font-size:12px"> </span></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a><span class="am-text-secondary"
                                                     style="cursor:pointer"><span></span>
                                                        详情</span></a>
                                            <a href="ticked-finance.jsp"><span class="am-text-secondary"
                                                                               style="cursor:pointer"><span></span>
                                                            融资</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr data-id="2">
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only">
                                    <span style="color: #ccc;font-size:12px"> </span></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td class="am-hide-sm-only"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a><span class="am-text-secondary"
                                                     style="cursor:pointer"><span></span>
                                                        详情</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <div class="am-cf">
                            <div class="am-fr">
                                <ul class="am-pagination tpl-pagination">
                                    <li><a id="left">«</a></li>
                                    <li><a id="right">»</a></li>
                                </ul>
                            </div>
                        </div>
                        <hr>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/app.js"></script>
<script type="text/javascript" src="assets/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
    var eid = '<%=request.getParameter("eid")%>';
    var name = '<%=request.getParameter("name")%>';
    var indexPage = '<%=request.getParameter("indexPage")%>';
    // alert(name);
    $("#rongzi").on("click", function () {
        window.location.href = "finance-list.jsp?eid=" + eid + "&name=" + name;
    });
    $("#myself").on("click", function () {
        window.location.href = "my-ticket-list.jsp?eid=" + eid + "&name=" + name;
    });
    $(document).ready(function () {
        $("#name").text(name);
        $.get("FMS/queryMyTicket", {"eid": eid}, function (List) {
            eval("var list=" + List);
            forFinancing(list.list)
        });
        $("#No").blur(function () {
            // alert($(this).val());
            select();
        });
        $("#enterprise").change(function () {
            alert($(this).val());
            select();
        });
        $("#open_enterprise").change(function () {
            // alert($(this).val());
            select();
        });
        $("[name='time']").change(function () {
            // alert($("[name='time']").val());
            select();
        });
        $("#Max").blur(function () {
            // alert($(this).val());
            select();
        });
        $("#Min").blur(function () {
            // alert($(this).val());
            select();
        });
        // 使用事件委托绑定点击事件
        $("tbody").on("click", ".detail_a", function () {
            var no = $(this).attr("name");
            window.location.href = "my-ticket-detail.jsp?no=" + no + "&eid=" + eid + "&name=" + name+"&indexPage="+indexPage;
        });
        $("tbody").on("click", ".detail_b", function () {
            var no = $(this).attr("name");
            window.location.href = "ticket-finance.jsp?no=" + no + "&eid=" + eid + "&name=" + name+"&indexPage="+indexPage;
        });
    });
    function select(){
        var no=$("#No").val();
        var enterprise_name=$("#enterprise").val();
        var open_enterprise_name=$("#open_enterprise").val();
        var Max=$("#Max").val();
        var Min=$("#Min").val();
        var create_time=$("[name='time']").val();
        $.get("FMS/queryMyTicket",{"eid":eid,"no":no,"enterprise_name":enterprise_name,"Max":Max,"Min":Min,"create_time":create_time,"indexPage":indexPage,"open_enterprise_name":open_enterprise_name},function (pojoAll) {
            eval("var pojoall="+pojoAll);
            forFinancing(pojoall.list);
            showButton(pojoAll);
        });
    }


    function forFinancing(list) {
        $("tbody").empty();
        $.each(list, function (index, item) {
            var statusText = item.status === "A" ? "未融资" : "已融资";
            var finText = item.fin === "A" ? "已放款" : "未放款";
            var tr = $("<tr>" +
                "<td>" + item.no + "</td>" +
                "<td>" + item.amount + "</td>" +
                "<td>" + item.open_enterprise_name + "</td>" +
                "<td>" + item.instituty_name + "</td>" +
                "<td>" + item.open_time + "</td>" +
                "<td>" + item.expiry_time + "<span style=\"color: #ccc;font-size:12px\"> 剩余" + item.receipt_day + "天 </span>" + "</td>" +
                "<td>" + item.uplink_address + "</td>" +
                "<td>" + item.source + "</td>" +
                "<td>" + statusText + "</td>" +
                "<td>" +
                "<div class='am-btn-toolbar'>" +
                "<div class='am-btn-group am-btn-group-xs'>" +
                "<a name='" + item.no + "' class='detail_a'>" + "<span class='am-text-secondary' style='cursor:pointer'>" + "详情" + "</span>" + "</a>" +
                (statusText === "未融资" ? "<a name='" + item.no + "' class='detail_b'>" + "<span class='am-text-secondary' style='cursor:pointer'>" + "融资" + "</span>" + "</a>" : "") +
                "</div>" +
                "</div>" +
                "</td>" +
                "</tr>");
            tr.appendTo("tbody");
        });
    }
    function showButton(pagehelper){
        if(pagehelper.indexPage<pagehelper.countPage && pagehelper.indexPage>1){
            $("#right").click(function(){
                // alert(pagehelper.indexPage+1);
                var indexPage=pagehelper.indexPage+1;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
            $("#left").click(function(){
                // alert(pagehelper.indexPage-1);
                var indexPage=pagehelper.indexPage-1;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
        }else if(pagehelper.indexPage==1){
            $("#left").click(function(){
                // alert(1);
                var indexPage=1;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
            $("#right").click(function(){
                var indexPage=pagehelper.indexPage+1;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
        }else if(pagehelper.indexPage==pagehelper.countPage){
            $("#right").click(function(){
                var indexPage=pagehelper.countPage;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
            $("#left").click(function(){
                var indexPage=pagehelper.indexPage-1;
                window.location.href="my-ticket-list.jsp?eid="+eid+"&indexPage="+indexPage+"&name="+name;
            });
        }
    }
</script>
</body>

</html>
